from openai import OpenAI
class Aliyun:
    def __init__(self):
        self.model_key = "your-apikey"
        self.model_endpoint = "https://dashscope.aliyuncs.com/compatible-mode/v1"
        self.model_name = "qwen-plus"

    def generate(self, prompt):
        client = OpenAI(
            api_key=self.model_key,
            base_url=self.model_endpoint,
        )

        completion = client.chat.completions.create(
            model=self.model_name,
            messages=[
                {"role": "system", "content": "你是一名资深教育专家."},
                {"role": "user", "content": prompt},
            ],
            extra_body={"enable_thinking": False},
        )
        return completion.choices[0].message.content